package personal.domain.accounting;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table (name="external_entity")
@NamedQueries({
	@NamedQuery(name=ExternalEntity.GET_ALL_ENTITIES, query="select ent from ExternalEntity ent order by lower(ent.entityName) asc")
})
public class ExternalEntity implements Serializable {
	private static final long serialVersionUID = 1L;
	public static final String GET_ALL_ENTITIES = "ExternalEntity.getAll";
	private Long entityId;
	private String entityName;
	private Long ieCategoryId;
	private IncomeExpenseCategory ieCategory;
	
	@Id
	@GeneratedValue (strategy=GenerationType.AUTO)
	@Column (name="entity_id", unique=true, length=11, nullable=false, insertable=true, updatable=false)
	public Long getEntityId() {
		return entityId;
	}
	public void setEntityId(Long entityId) {
		this.entityId = entityId;
	}
	@Column (name="entity_name", unique=false, length=100, nullable=false, insertable=true, updatable=true)
	public String getEntityName() {
		return entityName;
	}
	public void setEntityName(String entityName) {
		this.entityName = entityName;
	}
	@Column (name="ie_category_id", length=11, unique=false, nullable=false, insertable=true, updatable=true)
	public Long getIeCategoryId() {
		return ieCategoryId;
	}
	public void setIeCategoryId(Long ieCategoryId) {
		this.ieCategoryId = ieCategoryId;
	}
	
	@Transient
	public IncomeExpenseCategory getIeCategory() {
		return ieCategory;
	}
	
	public void setIeCategory(IncomeExpenseCategory ieCategory) {
		this.ieCategory = ieCategory;
	}
}
